package org.jeecg.modules.clue.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.enums.SqlMethod;
import org.jeecg.modules.clue.entity.InvestmentPromotionClue;
import org.jeecg.modules.clue.mapper.InvestmentPromotionClueMapper;
import org.jeecg.modules.clue.service.IInvestmentPromotionClueService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Collection;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Description: 招商线索表
 * @Author: jeecg-boot
 * @Date:   2022-01-27
 * @Version: V1.0
 */
@Service
public class InvestmentPromotionClueServiceImpl extends ServiceImpl<InvestmentPromotionClueMapper, InvestmentPromotionClue> implements IInvestmentPromotionClueService {

    private static Pattern humpPattern = Pattern.compile("[A-Z]");

    @Override
    public List<InvestmentPromotionClue> list(QueryWrapper<InvestmentPromotionClue> queryWrapper) {
        return this.getBaseMapper().selectList(queryWrapper);
    }

    @Override
    public String convertCamelCase(String str){
        Matcher matcher = humpPattern.matcher(str);
        StringBuffer sb = new StringBuffer();
        while (matcher.find()) {
            matcher.appendReplacement(sb, "_" + matcher.group(0).toLowerCase());
        }
        matcher.appendTail(sb);
        return sb.toString();
    }
}
